package cn.wolfcode.mq;

import cn.wolfcode.web.controller.OrderInfoController;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author hkj
 * @email 1349091387@qq.com
 * @date 2022/1/3
 * 源码允许修改，并且本人十分乐意有 大佬 来对代码进行 随 意 调 教
 **/
@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "MQChangeLocalSignListener",
        topic = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC,
        messageModel = MessageModel.BROADCASTING
)
public class MQChangeLocalSignListener implements RocketMQListener<Long> {

    @Override
    public void onMessage(Long seckillId) {
        log.info("进入到修改本地标识的消费者中");
        OrderInfoController.local_flag.put(seckillId,false);
    }
}
